<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="com.shixun.six.LJDBCUtils" %>
<%@ page import="java.sql.SQLException" %><%--
  Created by IntelliJ IDEA.
  User: 86147
  Date: 2023/12/27
  Time: 15:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>志愿者管理系统</title>
</head>
<body>
<%
    request.setCharacterEncoding("utf-8");
    String name=request.getParameter("name");
    String sex=request.getParameter("sex");
    String age=request.getParameter("age");
    String address=request.getParameter("address");
    String qq=request.getParameter("qq");
    String email=request.getParameter("email");
    String username=request.getParameter("username");
    String password=request.getParameter("password");
    try {
        Connection conn= LJDBCUtils.getConnection();
        String sql = "INSERT INTO student6  VALUES (null,?,?,?,?,?,?,?,?)";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        pstmt.setString(1,name);
        pstmt.setString(2,sex);
        pstmt.setString(3,age);
        pstmt.setString(4,address);
        pstmt.setString(5,qq);
        pstmt.setString(6,email);
        pstmt.setString(7,username);
        pstmt.setString(8,password);
        pstmt.executeUpdate();

    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
    response.sendRedirect("list.jsp");

%>

</body>
</html>
